package com.yangrd.airship.generator.page.impl;

import com.yangrd.airship.generator.page.enhance.PageBaseColumnRegistry;

import java.time.LocalDateTime;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author yangrd
 * @date 2021/11/8
 */
public class SimplePageBaseColumnRegistry implements PageBaseColumnRegistry {

    private final Map<String,String> baseColumnMap = new ConcurrentHashMap<>();

    {
        registry("createdTime", LocalDateTime.class.getName());
        registry("lastModifiedTime", LocalDateTime.class.getName()+",false");
    }

    @Override
    public void registry(String key, String val) {
        baseColumnMap.put(key,val);
    }

    @Override
    public void remove(String key) {
        baseColumnMap.remove(key);
    }

    @Override
    public Iterator<Map.Entry<String, String>> iterator() {
        return baseColumnMap.entrySet().iterator();
    }
}
